package com.ymatou.iapi.productquery.testcase;

import com.shop2cn.iapi.agentproducts.parameter.AddAgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.ImportAgentProductBean;
import com.ymatou.iapi.godfreightmgr.parameter.CreateFreightTemplateBean;
import com.ymatou.iapi.godmch.parameter.createmchBean;
import com.ymatou.iapi.prodstock.parameter.AuditProductActivityStockBean;
import com.ymatou.iapi.productmanager.parameter.SaveGrouponBean;
import com.ymatou.iapi.productmanager.parameter.product.AddSellerProductRequest;
import com.ymatou.iapi.productprice.parameter.ProductAllPriceBean;
import com.ymatou.iapi.productquery.parameter.ApplyActivityDto;
import com.ymatou.iapi.productquery.parameter.CatalogList.ProductInCartBean;
import com.ymatou.iapi.productquery.service.GetCatalogListByDeliveryExtraCall;
import com.ymatou.iapi.productquery.service.GetCatalogListByDeliveryExtraIsolationCall;
import com.ymatou.iapi.sellerproduct.service.ChangeNewProductInfoCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.*;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.YmtProductActivityStock;
import com.ymttest.database.mongo.YmtMongoDriverFactroy;
import com.ymttest.database.mongo.jproduct.ActivityProductsWapper;
import com.ymttest.database.sqlwapper.YmtCatalogsIWapper;
import com.ymttest.database.sqlwapper.YmtProductActivityStockWapper;
import com.ymttest.database.sqlwapper.godfreight.freight_templateWapper;
import com.ymttest.utils.*;

import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.*;
import org.junit.experimental.categories.Category;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

public class Ts_GetCatalogListByDeliveryExtra {
	private static GetCatalogListByDeliveryExtraCall getCatalogListByDeliveryExtraCall = new GetCatalogListByDeliveryExtraCall();
	private static GetCatalogListByDeliveryExtraIsolationCall getCatalogListByDeliveryExtraIsolationCall = new GetCatalogListByDeliveryExtraIsolationCall();
	
	private static Integer sellerId = Integer.valueOf(EnvSetup.getData("productpriceSellerId"));
	private static String sellerName = EnvSetup.getData("productpriceSellerName");	
	
	private static YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();
	private static ActivityProductsWapper activityProductsWapper = new ActivityProductsWapper();

	//渠道商
	private static int rootUserId = AgentUsers.rootUserId;
	private static String rootUserName = "NickautoTest";
	//渠道商->代理商1
	private static int agentUserId1 = AgentUsers.agentUserId1;
	private static String agentUserName1 = "NickautoTest";

	//vip渠道
	private static int vipRootUserId = AgentUsers.vipRootUserId;
	private static String vipRootUserName = "NickautoTest";
	//vip渠道->代理
	private static int vipAgentUserId1 = AgentUsers.vipAgentUserId1;
	private static String vipAgentUserName1 = "dgsq408897016";
	//vip渠道->代理->代理
	private static int vipAgentUserId2 = AgentUsers.vipAgentUserId2;
	private static String vipAgentUserName2 = "NickautoTest";
	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("非交易隔离查询接口, 多物流购物车中商品列表");
		try {
			GodfreightmgrService.deleteBySellerId(rootUserId);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	@Before
	public void caseUp() {
		
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getCatalogListByDeliveryExtraCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_GetCatalogListByDeliveryExtra_001() {
		Logger.start(true,"普通单规格商品，普通单规格直播商品 查询");
		try {
			//发布商品
			JSONObject addProductBean = JsonBeanHelper.getJsonBean("com.ymatou.iapi.sellerproduct/AddNewSellerProduct/AddNewProductTpl_Tc2.json");
			JsonBeanHelper.updateJsonBean(addProductBean, MapUtil.hashMap("UserID", sellerId,"LoginID", sellerName));
			String productId = SellerProductCallService.addNewProduct(addProductBean).getJSONObject("Data").getString("ProductID");
			
			
			//收集catalogs
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));

			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,true);

			//================================================================================
			//加入直播
			int liveId = LiveCallService.createLiveInProgress(sellerName, Integer.valueOf(sellerId)).getJSONObject("Data").getInt("ActivityId");
			SellerProductCallService.addProductInLive(sellerId, liveId, productId);
			
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,0,liveId,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,0,0,liveId,true);

			//================================================================================
			//结束直播
			LiveCallService.closeLive(liveId, Integer.valueOf(sellerId));
		
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,0,0,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,0,0,0,true);
			
			//================================================================================
			//加入未开始直播
			liveId = LiveCallService.createLiveBeginInFuture(sellerName, Integer.valueOf(sellerId)).getJSONObject("Data").getInt("ActivityId");
			SellerProductCallService.addProductInLive(sellerId, liveId, productId);
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,0,0,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,0,0,0,true);
			
			
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
		
	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_GetCatalogListByDeliveryExtra_002() {
		Logger.start(true, "普通多规格商品,普通多规格直播商品 查询");
		try {
			String productId = ProductQueryCallService.getNewProduct(sellerId, sellerName);
			
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			
			//check GetCatalogListByCatalogIdList
			
			checkByCatalogs(catalogAndTypeList,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,true);
			
			//================================================================================
			//加入直播
			int liveId = LiveCallService.createLiveInProgress(sellerName, Integer.valueOf(sellerId)).getJSONObject("Data").getInt("ActivityId");
			SellerProductCallService.addProductInLive(sellerId, liveId, productId);
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,0,liveId,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,0,0,liveId,true);
			
			//暂停销售
			SellerProductCallService.suspendSaleProductInLive(sellerId, liveId, productId);
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,0,0,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,0,0,0,true);
			
		}catch (Exception e) {
			Logger.fail(e); 
		}
	}
	
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_003() {
		Logger.start(true, "普通活动商品查询");
		int activityId = 0;
		try {
			String productId = ProductPriceCallService.getProdPriceWithActivity_NoNewBuyerAndNoIsolation(sellerId).getProductId();
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			
			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());
			
			
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,inaid,0,0,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,inaid,0,0,true);
			
			
			//结束活动
			//activityProductsWapper.update(inaid, MapUtil.hashMap("end",YMTDateUtil.getBeforeOrNextDate(-1))); 
			AdminCallService.closeProductInActivity(String.valueOf(inaid));
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,0,0,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,0,0,0,true);
			
		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}
	
	
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_004() {
		Logger.start(true, "交易隔离活动商品查询");
		int activityId = 0;
		try {
			String productId = ProductPriceCallService.getProdPriceWithActivity_NoNewBuyerAndIsolation(sellerId).getProductId();
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			
			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());
			
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,0,0,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,inaid,0,0,true);
			
			
			//结束活动
			//activityProductsWapper.update(inaid, MapUtil.hashMap("end",YMTDateUtil.getBeforeOrNextDate(-1))); 
			AdminCallService.closeProductInActivity(String.valueOf(inaid));
			
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,0,0,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,0,0,0,true);
			
			
		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}
	
	
	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_GetCatalogListByDeliveryExtra_005() {
		Logger.start(true, "活动直播商品查询");
		try {
			String productId = ProductPriceCallService.getProdPriceWithActivity_NoNewBuyerAndNoIsolation(sellerId).getProductId();
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			
			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			
			//================================================================================
			//加入直播
			int liveId = LiveCallService.createLiveInProgress(sellerName, Integer.valueOf(sellerId)).getJSONObject("Data").getInt("ActivityId");
			SellerProductCallService.addProductInLive(sellerId, liveId, productId);
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,inaid,0,liveId,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,inaid,0,liveId,true);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_006() {
		Logger.start(true,"普通多规格商品，增加规格");
		try {
			//发布商品
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
			addpro.getProduct().setPublishType(2);
			String productId =ProductManagerCallServiceV3.AddSellerProduct(addpro);
			Thread.sleep(1000);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,true);
			
			
			String fileName = "changenewproductinfocalltpl_003.json";
			new ChangeNewProductInfoCall().callAndGetReturnData(fileName,MapUtil.hashMap("LoginID", sellerName, "UserID", sellerId,"Product->sProductId",productId,"ProductID",productId));

			catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			
			
			YMTDateUtil.waitTime(5);
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,true);
			
			

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_007() {
		Logger.start(true, "普通下一场会员活动商品查询");
		int activityId = 0;
		try {
			String productId = ProductQueryCallService.getNewProduct(sellerId, sellerName);
			ProductPriceCallService.getProdPriceWithActivityInFuture(sellerId,productId,MapUtil.hashMap("ActivityTemplateId", 1));
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
				

			if (YmtMongoDriverFactroy.IsNewJavaMongoOpen){
				new ActivityProductsWapper().update(productId, MapUtil.hashMap("nbuyer",true,"isolation",false));
			}
			
			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());
			
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,inaid,0,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,0,inaid,0,true);
			
			
			//结束活动
			//activityProductsWapper.update(inaid, MapUtil.hashMap("end",YMTDateUtil.getBeforeOrNextDate(1))); 
			AdminCallService.closeProductInActivity(String.valueOf(inaid));
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,0,0,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,0,0,0,true);
			
		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}
	


	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_007_001() {
		Logger.start(true, "多个商品 普通下一场会员活动商品查询");
		try {
			String productId = ProductQueryCallService.getNewProduct(sellerId, sellerName);
			ProductPriceCallService.getProdPriceWithActivityInFuture(sellerId,productId,MapUtil.hashMap("ActivityTemplateId", 1));
			String catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).get(0).getsCatalogId();
									
			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			

			if (YmtMongoDriverFactroy.IsNewJavaMongoOpen){
				new ActivityProductsWapper().update(productId, MapUtil.hashMap("nbuyer",true,"isolation",false));
			}
			
			
			String productId2 = ProductQueryCallService.getNewProduct(sellerId, sellerName);
			ProductPriceCallService.getProdPriceWithActivityInFuture(sellerId,productId2,MapUtil.hashMap("ActivityTemplateId", 1));
			String catalogs2 = ymtCatalogsIWapper.selectCatalogsByProductId(productId2).get(0).getsCatalogId();
									
			int inaid2 = Integer.parseInt(activityProductsWapper.getByProdId(productId2).get("inaid").toString());
			if (YmtMongoDriverFactroy.IsNewJavaMongoOpen){
				new ActivityProductsWapper().update(productId, MapUtil.hashMap("nbuyer",true,"isolation",false));
			}
			
			
			JSONObject ret = getCatalogListByDeliveryExtraCall.search(MapUtil.hashMap(catalogs,0,catalogs2,0));
			JSONArray prodList = ret.getJSONObject("Data").getJSONArray("ProductList");
			
			//bean1 
			ProductInCartBean tgtbean = ProductQueryCallService.getProductInCartForDeliveryBean(catalogs,0,0,inaid,0);
			ProductInCartBean actBean = ProductQueryCallService.getBeanFromJson(prodList.getJSONObject(0),ProductInCartBean.class);
			
			
			//bean2
			ProductInCartBean tgtbean2 = ProductQueryCallService.getProductInCartForDeliveryBean(catalogs2,0,0,inaid2,0);
			ProductInCartBean actBean2 = ProductQueryCallService.getBeanFromJson(prodList.getJSONObject(1),ProductInCartBean.class);
			
			List<ProductInCartBean> tgtBeanList = Arrays.asList(tgtbean,tgtbean2);
			List<ProductInCartBean> actBeanList = Arrays.asList(actBean,actBean2);
			
			tgtBeanList.forEach(ele->{
				ProductInCartBean tmp=actBeanList.stream().filter(x->x.getCatalogId().equals(ele.getCatalogId())).findFirst().orElse(null);
				Logger.verifyNotNull(tmp, "期待结果不应为null:catalogid:" +ele.getCatalogId());
				ProductQueryCallService.compareProductInCartForDeliveryBean(ele, tmp,  "检查 GetCatalogListByCatalogIdList");
			});
			
			
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	

	
	
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_008() {
		Logger.start(true, "交易隔离下一场活动商品查询");
		int activityId = 0;
		try {
			String productId = ProductQueryCallService.getNewProduct(sellerId, sellerName);
			ProductPriceCallService.getProdPriceWithActivityInFuture(sellerId,productId,MapUtil.hashMap("ActivityTemplateId", 1));
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			

			if (YmtMongoDriverFactroy.IsNewJavaMongoOpen){
				new ActivityProductsWapper().update(productId, MapUtil.hashMap("nbuyer",true,"isolation",true));
			}
			
			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());
			
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,0,0,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,0,inaid,0,true);
			
			
			//结束活动
			//activityProductsWapper.update(inaid, MapUtil.hashMap("end",YMTDateUtil.getBeforeOrNextDate(1))); 
			AdminCallService.closeProductInActivity(String.valueOf(inaid));
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,0,0,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,0,0,0,true);
			
		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}
	
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_010() {
		Logger.start(true, "普通活动商品查询,库存为0");
		int activityId = 0;
		try {
			ProductAllPriceBean productAllPriceBean = ProductPriceCallService.getProdPriceWithActivity_NoNewBuyerAndNoIsolation(sellerId);
			String productId =productAllPriceBean.getProductId();
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
									
			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());
			
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,inaid,0,0,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,inaid,0,0,true);
			
			
			//活动库存为0 就移到下一场活动
			ProductPriceCallService.updateActivityStockTo0InMgo(productAllPriceBean, inaid);
			ProductManagerCallServiceV3.updateProductRedisTimeStamp(productId);
			
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,-1*inaid,0,0,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,-1*inaid,0,0,true);
			
		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}
	
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_011() {
		Logger.start(true, "交易隔离活动商品查询,库存为0");
		int activityId = 0;
		try {
			ProductAllPriceBean productAllPriceBean = ProductPriceCallService.getProdPriceWithActivity_NoNewBuyerAndIsolation(sellerId);String productId =productAllPriceBean.getProductId();
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
									
			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());
			
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,0,0,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,inaid,0,0,true);
			
			
			//活动库存为0 就移到下一场活动
			ProductPriceCallService.updateActivityStockTo0InMgo(productAllPriceBean, inaid);
			ProductManagerCallServiceV3.updateProductRedisTimeStamp(productId);
			
			
			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,0,0,false);
			
			//check GetCatalogListByTradeIsolation
			checkByCatalogs(catalogAndTypeList,-1*inaid,0,0,true);
			
		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}


	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_012() {
		Logger.start(true, "预售活动商品查询，非交易隔离");
		int activityId = 0;
		try {
			AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(activityStockBean.getProductID()).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			String BeginTime = YMTDateUtil.getBeforeOrNextHour(-1, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextHour(1, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setEndTime(EndTime);
			activityStockBean.setActivityType(2);
			activityStockBean.getFBXCatalogLockList().forEach(p->{
				p.setEarnest(10);
				p.setAction(1);
				p.setEarnestDedution(15);
			});
			ProdStockCallService.AuditProductActivityStock(activityStockBean);

			//平台预售活动扣除规格库存后活动商品暂时不同步到MongoDB，等待买手缴纳保证金
			YmtProductActivityStock productActivityStock = new YmtProductActivityStockWapper().selectByProductId(activityStockBean.getProductID()).get(0);
			Logger.verifyEquals(1,productActivityStock.getiAction(),"验证action为1");
			//更新活动更新活动商品状态（预售活动）
			ProdStockCallService.UpdateProductActivityStockAction(activityStockBean);

			new ActivityProductsWapper().update(activityStockBean.getProductID(), MapUtil.hashMap("isolation",false));


			String productId = activityStockBean.getProductID();
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().filter(x->x.equals(activityStockBean.getFBXCatalogLockList().get(0).getCatalogId())).forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));

			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());

			//check GetCatalogListByCatalogIdList
			Thread.sleep(2000);
			checkByCatalogs(catalogAndTypeList,inaid,0,0,false);
		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_014() {
		Logger.start(true, "预售活动商品查询，多活动，非交易隔离，露出预售活动(待排查)");
		int activityId = 0;
		try {
			AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(activityStockBean.getProductID()).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			String BeginTime = YMTDateUtil.getBeforeOrNextHour(-1, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextHour(1, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setEndTime(EndTime);
			activityStockBean.setActivityType(2);
			activityStockBean.getFBXCatalogLockList().forEach(p->{
				p.setEarnest(10);
				p.setAction(1);
				p.setEarnestDedution(15);
			});
			ProdStockCallService.AuditProductActivityStock(activityStockBean);

			//平台预售活动扣除规格库存后活动商品暂时不同步到MongoDB，等待买手缴纳保证金
			YmtProductActivityStock productActivityStock = new YmtProductActivityStockWapper().selectByProductId(activityStockBean.getProductID()).get(0);
			Logger.verifyEquals(1,productActivityStock.getiAction(),"验证action为1");
			//更新活动更新活动商品状态（预售活动）
			ProdStockCallService.UpdateProductActivityStockAction(activityStockBean);

			new ActivityProductsWapper().update(activityStockBean.getProductID(), MapUtil.hashMap("isolation",false));

			String lowPrice = "9.0";
			Date beginTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextHour(-3600));
			Date endTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(7200));
			//报名低优先级活动
			ProductPriceCallService priceCallService = new ProductPriceCallService();
			ApplyActivityDto activityDto = priceCallService.ApplyLowActivity(lowPrice,activityStockBean.getProductID(),beginTime,endTime);

			String productId = activityStockBean.getProductID();
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().filter(x->x.equals(activityStockBean.getFBXCatalogLockList().get(0).getCatalogId())).forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));

			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());

			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,inaid,0,0,false);
		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_013() {
		Logger.start(true, "预售活动商品查询，交易隔离");
		int activityId = 0;
		try {
			AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(activityStockBean.getProductID()).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			String BeginTime = YMTDateUtil.getBeforeOrNextHour(-1, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextHour(1, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setEndTime(EndTime);
			activityStockBean.setActivityType(2);
			activityStockBean.getFBXCatalogLockList().forEach(p->{
				p.setEarnest(10);
				p.setAction(1);
				p.setEarnestDedution(15);
			});
			ProdStockCallService.AuditProductActivityStock(activityStockBean);

			//平台预售活动扣除规格库存后活动商品暂时不同步到MongoDB，等待买手缴纳保证金
			YmtProductActivityStock productActivityStock = new YmtProductActivityStockWapper().selectByProductId(activityStockBean.getProductID()).get(0);
			Logger.verifyEquals(1,productActivityStock.getiAction(),"验证action为1");
			//更新活动更新活动商品状态（预售活动）
			ProdStockCallService.UpdateProductActivityStockAction(activityStockBean);

			new ActivityProductsWapper().update(activityStockBean.getProductID(), MapUtil.hashMap("isolation",true));


			String productId = activityStockBean.getProductID();
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().filter(x->x.equals(activityStockBean.getFBXCatalogLockList().get(0).getCatalogId())).forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));

			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());

			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,inaid,0,0,true);
		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_015() {
		Logger.start(true, "预售活动商品查询，多活动，交易隔离，露出预售活动");
		int activityId = 0;
		try {
			AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(activityStockBean.getProductID()).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			String BeginTime = YMTDateUtil.getBeforeOrNextHour(-1, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextHour(1, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setEndTime(EndTime);
			activityStockBean.setActivityType(2);
			activityStockBean.getFBXCatalogLockList().forEach(p->{
				p.setEarnest(10);
				p.setAction(1);
				p.setEarnestDedution(15);
			});
			ProdStockCallService.AuditProductActivityStock(activityStockBean);

			//平台预售活动扣除规格库存后活动商品暂时不同步到MongoDB，等待买手缴纳保证金
			YmtProductActivityStock productActivityStock = new YmtProductActivityStockWapper().selectByProductId(activityStockBean.getProductID()).get(0);
			Logger.verifyEquals(1,productActivityStock.getiAction(),"验证action为1");
			//更新活动更新活动商品状态（预售活动）
			ProdStockCallService.UpdateProductActivityStockAction(activityStockBean);

			new ActivityProductsWapper().update(activityStockBean.getProductID(), MapUtil.hashMap("isolation",true));

			String lowPrice = "9.0";
			Date beginTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
			Date endTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(7200));
			//报名低优先级活动
			ProductPriceCallService priceCallService = new ProductPriceCallService();
			ApplyActivityDto activityDto = priceCallService.ApplyLowActivity(lowPrice,activityStockBean.getProductID(),beginTime,endTime);


			String productId = activityStockBean.getProductID();
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().filter(x->x.equals(activityStockBean.getFBXCatalogLockList().get(0).getCatalogId())).forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));

			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());

			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,inaid,0,0,true);
		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_016() {
		Logger.start(true, "预售活动商品查询，活动未开始,非交易隔离，下一场活动不露预售活动");
		int activityId = 0;
		try {
			AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(activityStockBean.getProductID()).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			String BeginTime = YMTDateUtil.getBeforeOrNextHour(1, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextHour(2, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setEndTime(EndTime);
			activityStockBean.setActivityType(2);
			activityStockBean.getFBXCatalogLockList().forEach(p->{
				p.setEarnest(10);
				p.setAction(1);
				p.setEarnestDedution(15);
			});
			ProdStockCallService.AuditProductActivityStock(activityStockBean);

			//平台预售活动扣除规格库存后活动商品暂时不同步到MongoDB，等待买手缴纳保证金
			YmtProductActivityStock productActivityStock = new YmtProductActivityStockWapper().selectByProductId(activityStockBean.getProductID()).get(0);
			Logger.verifyEquals(1,productActivityStock.getiAction(),"验证action为1");
			//更新活动更新活动商品状态（预售活动）
			ProdStockCallService.UpdateProductActivityStockAction(activityStockBean);

			new ActivityProductsWapper().update(activityStockBean.getProductID(), MapUtil.hashMap("isolation",false));

			String productId = activityStockBean.getProductID();
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().filter(x->x.equals(activityStockBean.getFBXCatalogLockList().get(0).getCatalogId())).forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));

			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());

			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,inaid,0,false);
		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_018() {
		Logger.start(true, "预售活动商品查询，活动未开始,交易隔离，下一场活动不露预售活动");
		int activityId = 0;
		try {
			AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(activityStockBean.getProductID()).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			String BeginTime = YMTDateUtil.getBeforeOrNextHour(1, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextHour(2, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setEndTime(EndTime);
			activityStockBean.setActivityType(2);
			activityStockBean.getFBXCatalogLockList().forEach(p->{
				p.setEarnest(10);
				p.setAction(1);
				p.setEarnestDedution(15);
			});
			ProdStockCallService.AuditProductActivityStock(activityStockBean);

			//平台预售活动扣除规格库存后活动商品暂时不同步到MongoDB，等待买手缴纳保证金
			YmtProductActivityStock productActivityStock = new YmtProductActivityStockWapper().selectByProductId(activityStockBean.getProductID()).get(0);
			Logger.verifyEquals(1,productActivityStock.getiAction(),"验证action为1");
			//更新活动更新活动商品状态（预售活动）
			ProdStockCallService.UpdateProductActivityStockAction(activityStockBean);

			new ActivityProductsWapper().update(activityStockBean.getProductID(), MapUtil.hashMap("isolation",true));

			String productId = activityStockBean.getProductID();
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().filter(x->x.equals(activityStockBean.getFBXCatalogLockList().get(0).getCatalogId())).forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));

			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());

			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,inaid,0,true);
		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_017() {
		Logger.start(true, "预售活动商品查询，多活动未开始,非交易隔离，下一场活动露出低优先级活动");
		int activityId = 0;
		try {
			AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(activityStockBean.getProductID()).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			String BeginTime = YMTDateUtil.getBeforeOrNextHour(1, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextHour(2, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setEndTime(EndTime);
			activityStockBean.setActivityType(2);
			activityStockBean.getFBXCatalogLockList().forEach(p->{
				p.setEarnest(10);
				p.setAction(1);
				p.setEarnestDedution(15);
			});
			ProdStockCallService.AuditProductActivityStock(activityStockBean);
			Thread.sleep(2000);

			//平台预售活动扣除规格库存后活动商品暂时不同步到MongoDB，等待买手缴纳保证金
			YmtProductActivityStock productActivityStock = new YmtProductActivityStockWapper().selectByProductId(activityStockBean.getProductID()).get(0);
			Logger.verifyEquals(1,productActivityStock.getiAction(),"验证action为1");
			//更新活动更新活动商品状态（预售活动）
			ProdStockCallService.UpdateProductActivityStockAction(activityStockBean);

			new ActivityProductsWapper().update(activityStockBean.getProductID(), MapUtil.hashMap("isolation",false));

			String productId = activityStockBean.getProductID();
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().filter(x->x.equals(activityStockBean.getFBXCatalogLockList().get(0).getCatalogId())).forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));

			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());

			String lowPrice = "9.0";
			Date beginTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
			Date endTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(7200));
			//报名低优先级活动
			ProductPriceCallService priceCallService = new ProductPriceCallService();
			ApplyActivityDto activityDto = priceCallService.ApplyLowActivity(lowPrice,activityStockBean.getProductID(),beginTime,endTime);

			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,Integer.parseInt(activityDto.getAids().get(0)),0,false);
		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_019() {
		Logger.start(true, "预售活动商品查询，多活动未开始,交易隔离，下一场活动露出低优先级活动");
		int activityId = 0;
		try {
			AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(activityStockBean.getProductID()).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			String BeginTime = YMTDateUtil.getBeforeOrNextHour(1, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextHour(2, YMTDateUtil.YMDTHMS_STRING);
			activityStockBean.setEndTime(EndTime);
			activityStockBean.setActivityType(2);
			activityStockBean.getFBXCatalogLockList().forEach(p->{
				p.setEarnest(10);
				p.setAction(1);
				p.setEarnestDedution(15);
			});
			ProdStockCallService.AuditProductActivityStock(activityStockBean);

			//平台预售活动扣除规格库存后活动商品暂时不同步到MongoDB，等待买手缴纳保证金
			YmtProductActivityStock productActivityStock = new YmtProductActivityStockWapper().selectByProductId(activityStockBean.getProductID()).get(0);
			Logger.verifyEquals(1,productActivityStock.getiAction(),"验证action为1");
			//更新活动更新活动商品状态（预售活动）
			ProdStockCallService.UpdateProductActivityStockAction(activityStockBean);

			new ActivityProductsWapper().update(activityStockBean.getProductID(), MapUtil.hashMap("isolation",true));

			String productId = activityStockBean.getProductID();
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().filter(x->x.equals(activityStockBean.getFBXCatalogLockList().get(0).getCatalogId())).forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));

			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());

			String lowPrice = "9.0";
			Date beginTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
			Date endTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(7200));
			//报名低优先级活动
			ProductPriceCallService priceCallService = new ProductPriceCallService();
			ApplyActivityDto activityDto = priceCallService.ApplyLowActivity(lowPrice,activityStockBean.getProductID(),beginTime,endTime);

			//check GetCatalogListByCatalogIdList
			checkByCatalogs(catalogAndTypeList,0,Integer.parseInt(activityDto.getAids().get(0)),0,true);
		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_020() {
		Logger.start(true, "拼团商品查询,非交易隔离");
		int activityId = 0;
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			setStock(addpro, 30);
			setPrice(addpro, 100d);
			String pid = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Double groupPrice = 50d;
			SaveGrouponBean saveGrouponBean = ProductManagerCallServiceV3.initSaveGrouponBean(sellerId,pid,groupPrice);
			ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(pid).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			Logger.debug("catalogs："+catalogs);
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			Logger.debug("catalogAndTypeList:"+catalogAndTypeList);
			checkByCatalogs(catalogAndTypeList,0,0,0,false);

		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_021() {
		Logger.start(true, "神器商品，渠道商商品");
		try {
			AddAgentProductBean agentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,rootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(agentProductBean);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			checkByCatalogsV2(catalogAndTypeList);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_02() {
		Logger.start(true, "神器商品，渠道商保存商品");
		try {
			AddAgentProductBean agentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,rootUserName,true);
			agentProductBean.setSaleType(2);
			String productId = AddAgentProductCallService.AddAgentProduct(agentProductBean);

			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			checkByCatalogsV2(catalogAndTypeList);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_024() {
		Logger.start(true, "神器商品，普通渠道->普通代理，普通代理商品");
		try {
			AddAgentProductBean agentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,rootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(agentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1, agentUserName1, productId, rootUserId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			checkByCatalogsV2(catalogAndTypeList);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_022() {
		Logger.start(true, "神器商品，vip渠道->vip1->vip2,vip渠道商品，获取vip2商品");
		try {
			AddAgentProductBean agentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(agentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId2,vipAgentUserName2,agentProductId,vipAgentUserId1,false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId1).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			checkByCatalogsV2(catalogAndTypeList);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}


	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_023() {
		Logger.start(true, "神器商品，vip渠道->vip1->vip2,vip渠道下架商品，获取vip1渠道，vip1商品，vip2商品");
		int activityId = 0;
		try {
			AddAgentProductBean agentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(agentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId2,vipAgentUserName2,agentProductId,vipAgentUserId1,false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			
			AddAgentProductCallService.SetOffshelf(productId,vipRootUserId);
			Thread.sleep(3000);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			checkByCatalogsV2(catalogAndTypeList);

			catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList1 = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList1.add(Arrays.asList(ele,"0")));
			checkByCatalogsV2(catalogAndTypeList1);

			catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId1).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList2 = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList2.add(Arrays.asList(ele,"0")));
			checkByCatalogsV2(catalogAndTypeList2);

		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_025() {
		Logger.start(true, "神器商品，vip渠道->vip1->vip2,vip1下架商品，获取vip1商品，vip2商品");
		int activityId = 0;
		try {
			AddAgentProductBean agentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(agentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId2,vipAgentUserName2,agentProductId,vipAgentUserId1,false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			AddAgentProductCallService.SetOffshelf(agentProductId,vipAgentUserId1);
			Thread.sleep(3000);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			checkByCatalogsV2(catalogAndTypeList);

			catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId1).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList1 = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList1.add(Arrays.asList(ele,"0")));
			checkByCatalogsV2(catalogAndTypeList1);

		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_GetCatalogListByDeliveryExtra_026() {
		Logger.start(true, "神器商品，vip渠道->vip1->vip2,vip渠道删除商品，获取vip渠道，vip1商品，vip2商品");
		int activityId = 0;
		try {
			AddAgentProductBean agentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(agentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);

			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId2,vipAgentUserName2,agentProductId,vipAgentUserId1,false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			AddAgentProductCallService.DeleteProduct(productId,vipRootUserId);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId1).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			Logger.debug("catalogs："+catalogs);
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			Logger.debug("catalogAndTypeList:"+catalogAndTypeList);
			checkByCatalogs(catalogAndTypeList,0,0,0,false);

		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_GetCatalogListByDeliveryExtra_027() {
		Logger.start(true, "神器商品，vip渠道->vip1->vip2,vip1删除商品，获取vip1商品，vip2商品");
		int activityId = 0;
		try {
			AddAgentProductBean agentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(agentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);

			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId2,vipAgentUserName2,agentProductId,vipAgentUserId1,false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			AddAgentProductCallService.DeleteProduct(productId,vipRootUserId);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(agentProductId1).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			Logger.debug("catalogs："+catalogs);
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			Logger.debug("catalogAndTypeList:"+catalogAndTypeList);
			checkByCatalogs(catalogAndTypeList,0,0,0,false);

		}catch (Exception e) {
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}


	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_028() {
		Logger.start(true, "神器商品，带运费模板，渠道商商品");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(createmchBean.getMchId(),createmchBean.getNickName(),false);
			CreateFreightTemplateBean createFreightTemplateBean = GodfreightmgrService.initCreateFreightTemplate(createmchBean.getMchId(), 1, 2);
			String templateId = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean);
			addAgentProductBean.setFreightTemplateId(Integer.parseInt(templateId));
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			checkByCatalogsV2(catalogAndTypeList);
			freight_templateWapper templateWapper = new freight_templateWapper();
			templateWapper.updateStatusByKey(Integer.parseInt(templateId));
		}catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_029() {
		Logger.start(true, "商品拼邮国内发货");
		try {
			AddSellerProductRequest addSellerProductRequest = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
			addSellerProductRequest.getProduct().setPackageDeliveryType(2);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addSellerProductRequest);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			checkByCatalogs(catalogAndTypeList,false);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_030() {
		Logger.start(true, "商品拼邮海外发货");
		try {
			AddSellerProductRequest addSellerProductRequest = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
			addSellerProductRequest.getProduct().setPackageDeliveryType(1);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addSellerProductRequest);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			checkByCatalogs(catalogAndTypeList,false);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_031() {
		Logger.start(true, "查询增加商品条码");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			List<String> barCodes = Arrays.asList("A123_b123_"+TestDataManager.getRandomNum(10),"A123_b123_"+TestDataManager.getRandomNum(10));
			addAgentProductBean.getCatalogList().get(0).setBarcode(barCodes.get(0));;
			addAgentProductBean.getCatalogList().get(1).setBarcode(barCodes.get(1));;
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(3000);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele -> ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			JSONObject ret = getCatalogListByDeliveryExtraIsolationCall.search(catalogAndTypeList.get(0));
			String barCode = ret.getJSONObject("Data").getJSONArray("ProductList").getJSONObject(0).getString("BarCode");
			Logger.verifyEquals(barCodes.get(0), barCode, "验证条形码");
			
			
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetCatalogListByDeliveryExtra_032() {
		Logger.start(true, "查询增加发布类型");
		try {
			//发布商品
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
			addpro.getProduct().setPublishType(2);
			String productId =ProductManagerCallServiceV3.AddSellerProduct(addpro);
			Thread.sleep(1000);
			List<String> catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId).stream().map(ele->ele.getsCatalogId()).collect(Collectors.toList());
			List<List<String>> catalogAndTypeList = new ArrayList<>();
			catalogs.stream().forEach(ele->catalogAndTypeList.add(Arrays.asList(ele,"0")));
			JSONObject ret = getCatalogListByDeliveryExtraIsolationCall.search(catalogAndTypeList.get(0));
			int PublishType = ret.getJSONObject("Data").getJSONArray("ProductList").getJSONObject(0).getInt("PublishType");
			Logger.verifyEquals(2, PublishType, "验证PublishType");
			
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	//http://wiki.ymatou.cn:8090/pages/viewpage.action?pageId=29134363 物流 2020
	public void Tc_GetCatalogListByDeliveryExtra_033() {
		//http://172.16.100.245/PRDList/%E5%A5%A2%E5%93%81%E6%8A%A4%E8%88%AAV1.1%2020200817/#id=62vt03&p=%E7%BB%93%E7%AE%97%E9%A1%B5&g=1
		Logger.start(true,"指定品类奢侈品输出提示字段luxuryTips");
		try {
			AddSellerProductRequest addProdReq =ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(3383);
			while(addProdReq.getProduct().getCatalogList().size()>1) {
				addProdReq.getProduct().getCatalogList().remove(0);
			}
			//disconf  luxuryTipsSecondCategoryIds=1087,1130
			 addProdReq.getProduct().setSecondCategoryId(1130);
			addProdReq.getProduct().getCatalogList().get(0).setPrice(10000);
            addProdReq.getProduct().getCatalogList().get(0).setNewPrice(10000);
            addProdReq.getProduct().getCatalogList().get(0).setVipPrice(10000);
            addProdReq.getProduct().getCatalogList().get(0).setMarketPrice(18000);
            String pid = ProductManagerCallServiceV2.addNewProduct(addProdReq).get("Data").getAsJsonObject().get("ProductId").getAsString();
            Thread.sleep(3000);
            List<String> c = ProductManagerCallServiceV2.getCatalogList(pid);
            //"luxuryTips":"美妆保养类商品需要拆封鉴别，商品品质可能会有所影响"
            JSONObject ret = getCatalogListByDeliveryExtraIsolationCall.search(Arrays.asList(c.get(0),"0"));
            Logger.verifyIsContains("拆封鉴别", ret.getJSONObject("Data").getJSONArray("ProductList").getJSONObject(0).getString("luxuryTips"),"验证返回字段luxuryTips");
            JSONObject ret2 = getCatalogListByDeliveryExtraCall.search(Arrays.asList(c.get(0),"0"));
            Logger.verifyIsContains("拆封鉴别",ret2.getJSONObject("Data").getJSONArray("ProductList").getJSONObject(0).getString("luxuryTips"),"验证返回字段luxuryTips");
		}catch (Exception e) {
			Logger.fail(e);
		}
	}

	private void setStock(AddSellerProductRequest addpro, Integer catalogNum) {
		addpro.getProduct().getCatalogList().forEach(catalog -> {
			catalog.setStock(catalogNum);
		});
	}

	private void setPrice(AddSellerProductRequest addpro, Double price) {
		addpro.getProduct().getCatalogList().forEach(catalog -> {
			catalog.setNewPrice(price);
			catalog.setMarketPrice(price);
			catalog.setVipPrice(price);
			catalog.setPrice(price);
		});
	}
	
	public static void checkByCatalogs(List<List<String>> catalogAndTypeList,boolean isTradeIsolation) throws Exception{
		checkByCatalogs(catalogAndTypeList,0,0,0,isTradeIsolation);
	}
	
	

	public static void checkByCatalogs(List<List<String>> catalogAndTypeList, int prodInActivityId, int prodInNextActivityId,int liveId,boolean isTradeIsolation) throws Exception{
		YMTDateUtil.waitTime(2);
		//mongo库中取值

			for(int i=0;i<catalogAndTypeList.size();i++){
				List<String> catalogAndType = catalogAndTypeList.get(i);

				JSONObject ret;
				String chkdesc;
				if (isTradeIsolation){
					//交易隔离接口
					ret = getCatalogListByDeliveryExtraIsolationCall.search(catalogAndType);
					chkdesc = "检查 GetCatalogListByTradeIsolation";
				}else{

					//普通交易不隔离接口
					ret = getCatalogListByDeliveryExtraCall.search(catalogAndType);
					chkdesc = "检查 GetCatalogListByCatalogIdList";
				}
				ProductInCartBean tgtbean = ProductQueryCallService.getProductInCartForDeliveryBean(catalogAndType.get(0),
						Integer.parseInt(catalogAndType.get(1)), prodInActivityId,prodInNextActivityId, liveId);
				//返回码检查
				Logger.verifyEquals(200, ret.getInt("Code"), "返回码检查");
				JSONArray prodList = ret.getJSONObject("Data").getJSONArray("ProductList");
				ProductInCartBean actBean = ProductQueryCallService.getBeanFromJson(prodList.getJSONObject(0),ProductInCartBean.class);

				System.out.println("tgt:"+tgtbean);
				System.out.println("act:"+actBean);
				//返回值比对
				ProductQueryCallService.compareProductInCartForDeliveryBean(tgtbean, actBean, chkdesc);
		}
	}

	public static void checkByCatalogsV2(List<List<String>> catalogAndTypeList) throws Exception{
		YMTDateUtil.waitTime(2);
		//mongo库中取值

		for(int i=0;i<catalogAndTypeList.size();i++){
			List<String> catalogAndType = catalogAndTypeList.get(i);

			JSONObject ret;
			String chkdesc;
			ret = getCatalogListByDeliveryExtraCall.search(catalogAndType);
			chkdesc = "检查 GetCatalogListByCatalogIdList";
			ProductInCartBean tgtbean = ProductQueryCallService.getProductInCartForDeliveryBean(catalogAndType.get(0),
					Integer.parseInt(catalogAndType.get(1)));
			//返回码检查
			Logger.verifyEquals(200, ret.getInt("Code"), "返回码检查");
			JSONArray prodList = ret.getJSONObject("Data").getJSONArray("ProductList");
			ProductInCartBean actBean = ProductQueryCallService.getBeanFromJson(prodList.getJSONObject(0),ProductInCartBean.class);

			//返回值比对
			ProductQueryCallService.compareProductInCartForDeliveryBean(tgtbean, actBean, chkdesc);
		}
	}
	

}
